import request from '@/utils/request'


// 公司信息开始---------------------------
export function getCompanies(params) {
  return request({
    url: '/base/company/',
    method: 'GET',
    params
  })
}

export function addCompany(data) {
  return request({
    url: '/base/company/',
    method: 'POST',
    data
  })
}


export function updateCompany(data) {
  return request({
    url: `/base/company/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCompany(id) {
  return request({
    url: `/base/company/${id}/`,
    method: 'DELETE',
  })
}

// 公司信息结束----------------------------


// 计量单位开始---------------------------
export function getUnits(params) {
  return request({
    url: '/base/unit/',
    method: 'GET',
    params
  })
}

export function getUnitList() {
  return request({
    url: '/base/unit_list/',
    method: 'GET',
  })
}

export function addUnit(data) {
  return request({
    url: '/base/unit/',
    method: 'POST',
    data
  })
}


export function updateUnit(data) {
  return request({
    url: `/base/unit/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delUnit(id) {
  return request({
    url: `/base/unit/${id}/`,
    method: 'DELETE',
  })
}


export function delUnits(data) {
  return request({
    url: '/base/unit/batch_delete/',
    method: 'DELETE',
    data
  })
}
// 计量单位结束----------------------------

// 商品分类开始---------------------------
export function getCategories() {
  return request({
    url: '/base/cate_list/',
    method: 'GET',
  })
}


export function addCategory(data) {
  return request({
    url: '/base/category/',
    method: 'POST',
    data
  })
}


export function updateCategory(data) {
  return request({
    url: `/base/category/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCategory(id) {
  return request({
    url: `/base/category/${id}/`,
    method: 'DELETE',
  })
}

// export function delCategories(data) {
//   return request({
//     url: '/base/category/batch_delete/',
//     method: 'DELETE',
//     data
//   })
// }

// 商品分类结束----------------------------


// 仓库开始---------------------------
export function getHouses(params) {
  return request({
    url: '/base/house/',
    method: 'GET',
    params,
  })
}


export function getHouseList() {
  return request({
    url: '/base/house_list/',
    method: 'GET',
  })
}

export function addHouse(data) {
  return request({
    url: '/base/house/',
    method: 'POST',
    data
  })
}


export function updateHouse(data) {
  return request({
    url: `/base/house/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delHouse(id) {
  return request({
    url: `/base/house/${id}/`,
    method: 'DELETE',
  })
}


export function delHouses(data) {
  return request({
    url: '/base/house/batch_delete/',
    method: 'DELETE',
    data
  })
}
// 仓库结束----------------------------

// 客商分类开始----------------------------
export function getCustSuppClasses(params) {
  return request({
    url: '/base/cust_supplier_class_list/',
    method: 'GET',
    params,
  })
}


export function addCustSuppClass(data) {
  return request({
    url: '/base/cust_supplier_class/',
    method: 'POST',
    data
  })
}


export function updateCustSuppClass(data) {
  return request({
    url: `/base/cust_supplier_class/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCustSuppClass(id) {
  return request({
    url: `/base/cust_supplier_class/${id}/`,
    method: 'DELETE',
  })
}

// export function delCustSuppClasses(data) {
//   return request({
//     url: '/base/cust_supplier_class/batch_delete/',
//     method: 'DELETE',
//     data
//   })
// }

// 客商分类结束----------------------------

//客户供应商开始---------------

export function getCustomSupplierList() {
  return request({
    url: '/base/custom_supplier_list/',
    method: 'GET',
  })
}
//客户供应商结束

// 客户资料开始---------------------------

export function getCustSuppMaxCode() { 
  return request({
    url: '/base/cust_supplier_code/',
    method: 'GET',
  })
}


export function getCustomers(params) {
  return request({
    url: '/base/customer/',
    method: 'GET',
    params
  })
}

export function getCustomerList() {
  return request({
    url: '/base/customer_list/',
    method: 'GET',
  })
}

export function addCustomer(data) {
  return request({
    url: '/base/customer/',
    method: 'POST',
    data
  })
}



export function updateCustomer(data) {
  return request({
    url: `/base/customer/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delCustomer(id) {
  return request({
    url: `/base/customer/${id}/`,
    method: 'DELETE',
  })
}

export function delCustomers(data) {
  return request({
    url: '/base/customer/batch_delete/',
    method: 'DELETE',
    data
  })
}

// 客户资料结束----------------------------


// 供应商开始----------------------------
export function getSuppliers(params) {
  return request({
    url: '/base/supplier/',
    method: 'GET',
    params
  })
}

export function getSupplierList() {
  return request({
    url: '/base/supplier_list/',
    method: 'GET',
  })
}

export function addSupplier(data) {
  return request({
    url: '/base/supplier/',
    method: 'POST',
    data
  })
}


export function updateSupplier(data) {
  return request({
    url: `/base/supplier/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delSupplier(id) {
  return request({
    url: `/base/supplier/${id}/`,
    method: 'DELETE',
  })
}

export function delSuppliers(data) {
  return request({
    url: '/base/supplier/',
    method: 'DELETE',
    data
  })
}

// 供应商结束----------------------------

// 商品开始---------------------------

export function getGoodsMaxCode() {
  return request({
    url: '/base/goods_code/',
    method: 'GET',
  })
}

export function getGoodsCodeList(params) {
  return request({
    url: '/base/goods_code_list/',
    method: 'GET',
    params
  })
}

export function getGoods(params) {
  return request({
    url: '/base/goods/',
    method: 'GET',
    params
  })
}

export function getGoodsCodes(params) {
  return request({
    url: '/base/goods_list/',
    method: 'GET',
    params
  })
}


export function addGoods(data) {
  return request({
    url: '/base/goods/',
    method: 'POST',
    data
  })
}


export function updateGoods(data) {
  return request({
    url: `/base/goods/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delGoods(id) {
  return request({
    url: `/base/goods/${id}/`,
    method: 'DELETE',
  })
}

export function delMultiGoods(data) {
  return request({
    url: '/base/goods/batch_delete/',
    method: 'DELETE',
    data
  })
}

//商品结束----------------------------
//会计科目开始
export function hanzi2pinyin(params) {
  return request({
    url: '/base/hz2py/',
    method: 'GET',
    params
  })
}

export function getAccountTitles(query) {
  return request({
    url: '/base/account/',
    method: 'GET',
    params: query
  })
}

export function addAccountTitle(data){
  return request({
    url: '/base/account/',
    method: 'POST',
    data
  })
}

export function updateAccountTitle(data){
  return request({
    url: `/base/account/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delAccountTitle(account_id){
  return request({
    url: `/finance/account/${account_id}/`,
    method: 'DELETE',
  })
}
///会计科目结束

// 员工开始
export function getEmployees(params){
  return request({
    url: '/base/employee/',
    method: 'GET',
    params
  })
}

export function addEmployee(data){
  return request({
    url: '/base/employee/',
    method: 'POST',
    data
  })
}

export function updateEmployee(data){
  return request({
    url: `/base/employee/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delEmployee(employee_id){
  return request({
    url: `/base/employee/${employee_id}/`,
    method: 'DELETE',
  })
}

export function getEmployeeList(){
  return request({
    url: '/base/employee_list/',
    method: 'GET'
  })
}